<script setup lang="ts" xmlns="http://www.w3.org/1999/html">
import {ref} from "vue";
import router from "@/router";
const types=ref(['seller','admin','buyer',"superAdmin"]);
const login=(element)=>{
  // console.log(element.target.value)
  router.push({
    path:'login',
    query:{
      params:JSON.stringify({type:element.target.value})
    }
  })
}
const register=(element)=>{
  // console.log(element.target.value)
  router.push({
    path:'register',
    query:{
      params:JSON.stringify({type:element.target.value})
    }
  })
}
const superAdminLogin=(element)=>{
  router.push({
    path:'login',
    query:{
      params:JSON.stringify({type:types.value[3]})
    }
  })
}
</script>

<template>
  <main>
    <div class="content">
      <p class="title">鲜花交易中心</p>
      <p class="title2">欢迎您</p>
      <div class="superAdmin" @click="superAdminLogin">
        <p>我是超级管理员</p>
      </div>
      <div class="selects">

        <div @submit.prevent="handleSubmit" class="select">
          <div class="icon">商家</div>
          <p>我是商家</p>
          <div class="buttons">
            <button type="submit" :value=types[0] @click="login">登录</button>
            <button type="submit" :value=types[0] @click="register">注册</button>
          </div>
        </div>

        <div @submit.prevent="handleSubmit" class="select">
          <div class="icon">管理员</div>
          <p>我是管理员</p>
          <div class="buttons">
            <button type="submit" :value=types[1] @click="login">登录</button>
            <button type="submit" :value=types[1] @click="register">注册</button>
          </div>
        </div>

        <div @submit.prevent="handleSubmit" class="select">
          <div class="icon">顾客</div>
          <p>我是顾客</p>
          <div class="buttons">
            <button type="submit" :value=types[2] @click="login">登录</button>
            <button type="submit" :value=types[2] @click="register">注册</button>
          </div>
        </div>
      </div>
    </div>
  </main>
</template>

<style scoped>
*{
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}
main{
  width: 100vw;
  height: 100vh;
  background-image: url("../assets/images/index5.png");
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  display: flex;
  justify-content: center;
  align-items: center;
  .content{
    width: 100%;
    height: auto;
    color: black;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    .title{
      color: white;
      font-size: 50px;
      font-weight: lighter;
    }
    .title2{
      color: white;
      font-size: 20px;
      margin-bottom: 60px;
    }
    .superAdmin{
      box-shadow: 10px 10px 10px 0 rgba(0,0,0,0.3);
      width: 15%;
      height: auto;
      padding: 30px;
      border-radius: 15px;
      background-color: rgba(255, 255, 255, 0.5);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      transition: 0.5s;
      margin-bottom: 50px;
    }
    .superAdmin:hover{
      background-color: rgba(255, 255, 255, 1);
      transition: 0.5s;
      color: black;
      cursor: pointer;
    }
    .selects{
      width: 60%;
      height: 50%;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 10%;
      padding-bottom: 50px;
      .select{
        box-shadow: 10px 10px 10px 0 rgba(0,0,0,0.3);
        width: 30%;
        height: auto;
        padding: 30px;
        border-radius: 15px;
        background-color: rgba(255, 255, 255, 0.5);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        transition: 0.5s;
        gap: 30px;
      }
      .select:hover{
        background-color: rgba(255, 255, 255, 1);
        transition: 0.5s;
        color: black;
      }
      .icon{
        width: 80px;
        height: 80px;
        border-radius: 50%;
        display: flex;
        justify-content: center;
        align-items: center;
        border: 1px solid black;
      }
      .buttons{
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        *{
          text-decoration: none;
          color: black;
        }
      }
    }
  }
}
</style>